package com.miniapp.conifg;

import com.miniapp.handler.ApiInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created with IntelliJ IDEA.
 * User: linyuchi
 * Date: 2018/6/14
 * Time: 22:15
 * Description: No Description
 */
@Configuration
@Component
public class ApiInterceptorConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(apiInterceptor())
                .addPathPatterns("/api/**").excludePathPatterns("/api/sh_pay/notify");
        super.addInterceptors(registry);
    }
    @Bean
    public ApiInterceptor apiInterceptor() {
        return new ApiInterceptor();
    }
}
